package com.sky.mapper;

import com.sky.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.Map;

@Mapper
public interface UserMapper {


    /**
     * @description: 根据openid查询用户
     * @author: zhouzhijie
     * @date: 2023/11/20 16:32
     * @param: [openid]
     * @return:
     **/
    @Select("select * from user where openid = #{openid}")
    User getByOpenid(String openid);

    /**
     * @description: 插入用户信息
     * @author: zhouzhijie
     * @date: 2023/11/20 16:42
     * @param: [user]
     * @return:
     **/
    void insert(User user);

    /**
     * @description: 根据id查询用户信息
     * @author: zhouzhijie
     * @date: 2023/11/23 9:48
     * @param: [userId]
     * @return:
     **/
    @Select("select * from user where id = #{id}")
    User getById(Long id);

    /**
     * @description: 根据动态条件统计用户数量
     * @author: zhouzhijie
     * @date: 2023/11/28 20:04
     * @param: [map]
     * @return:
     **/
    Integer countByMap(Map map);
}
